package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.JsonLoginUser;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * 接收Json请求参数
 */
@RestController
@RequestMapping("json")
public class JsonParamController {

    //JavaBean或Map来接收
    @RequestMapping("login")
    public BaseRespVo login(@RequestBody JsonLoginUser user) {
        return BaseRespVo.ok();
    }
    //JavaBean或Map来接收
    @RequestMapping("login2")
    public BaseRespVo login2(@RequestBody Map user) {
        String username = (String) user.get("username");
        String password = (String) user.get("password");
        return BaseRespVo.ok();
    }
}
